
package statcomponent.rules;

import constants.NumberConstants;
import statcomponent.AbstractStatRule;
import utils.DoubleUtils;

/**
 * 整形合并计算器
 *
 * @author chenfoxin
 * @date 2022年09月01日 9:09
 */
public class DoubleStatRule extends AbstractStatRule<Double,Double> {
    private Double result = NumberConstants.DOUBLE_ZERO;

    private int scale = NumberConstants.INT_TWO;;

    public DoubleStatRule(int scale) {
        this.scale = scale;
    }

    @Override
    public void doStat(Double statValue) {
        result = DoubleUtils.add(scale,statValue,result);
    }

    @Override
    public Double result() {
        return result;
    }
}